CC	=wine c:\\\\MSVC\\\\Bin\\\\Cl.exe
LB	=wine c:\\\\MSVC\\\\Bin\\\\Lib.exe
LD	=wine c:\\\\MSVC\\\\Bin\\\\Link.exe
AS	=wine c:\\\\MASM611\\\\BIN\\\\ML.EXE
DD	=dd

SLIBCE	=c:\\MSVC\\Lib\\Slibce.lib

C_SRCS	=$(wildcard *.c)
A_SRCS	=$(wildcard *.asm)

OBJS	=$(patsubst %.asm,%.obj,$(A_SRCS)) \
	 $(patsubst %.c,%.obj,$(C_SRCS)) \

DEBUG	=/DDEBUG=0

CFLAGS	=/AT /Asw /Fc /G3 /Gf /Gr /Gs /Gx- /Od /W4 /WX /Zl /Zp1 \
	 /c /f- /nologo /Iinc /D__FAR=far /D__CDECL=cdecl $(DEBUG)
AFLAGS	=/Cp /Fl /W3 /WX /Zf /Zp1 /c /nologo /Iinc $(DEBUG)
LDFLAGS	=/map /nodef /noext /noign /nologo /onerr:noexe /tiny

TARGET	=boot.bin

all:charset.c $(TARGET)

$(TARGET):boot.com
	$(DD) <$< >$@ bs=512 skip=62
charset.c:inc/msg.h
	$(MAKE) install -C tools
boot.com:$(OBJS)
	$(LD) $(LDFLAGS) $^,$@,,$(SLIBCE),,

%.obj:%.c
	$(CC) $(CFLAGS) $<
%.obj:%.asm
	$(AS) $(AFLAGS) $<

clean:
	-rm -f *.obj *.com *.lst *.map $(TARGET) *.cod
install:
	cp -f $(TARGET) /mnt
